package com.itheima.health.controller;

import com.itheima.health.dto.CheckGroupDTO;
import com.itheima.health.dto.SetmealDTO;
import com.itheima.health.entity.QueryPageBean;
import com.itheima.health.entity.Result;
import com.itheima.health.service.CheckGroupService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.*;

@RestController
public class CheckGroupController {
    @Reference
    private CheckGroupService checkGroupService;
    @PostMapping("checkgroup/findPage")
    public Result findPage(@RequestBody QueryPageBean queryPageBean) {
        return new Result(checkGroupService.findPage(queryPageBean));
    }

    @GetMapping("checkgroup/findChecked/{id}")
    public Result findChecked(@PathVariable int id) {
        return new Result(checkGroupService.findChecked(id));
    }

    @PostMapping("checkgroup/add")
    public Result add(@RequestBody CheckGroupDTO checkGroupDTO) {

        return  new Result(checkGroupService.saveCheckGroup(checkGroupDTO));
    }

    @GetMapping("checkgroup/findAll")
    public Result findAll() {
        return new Result(checkGroupService.list());
    }


}
